from selenium import webdriver
from selenium.webdriver.common.by import By

from static import login_web1

with webdriver.Firefox() as driver:
    driver.get(login_web1)
    driver.implicitly_wait(10)
    id_card_input = driver.find_element(By.NAME,
                                        r"ksIDNO")
    id_card_input.send_keys('12345678901234')
    passwd_input = driver.find_element(By.XPATH,
                                       r'/html/body/div[2]/div[4]/div[1]/div[2]/form/table/tbody/tr[4]/td[2]/input')
    passwd_input.send_keys('12345676')
    try:
        alertObject = driver.switch_to.alert
        alertObject.accept()
    except:
        pass

    auth_code_input = driver.find_element(By.XPATH,
                                          r'/html/body/div[2]/div[4]/div[1]/div[2]/form/table/tbody/tr[6]/td[2]/input')
    auth_code_input.click()

    driver.implicitly_wait(3)
    try:

        auth_image = driver.find_element(By.NAME, 'chkImg')
        auth_image_url = auth_image.get_attribute("src")

    except:
        pass

    pass
